package com.jiyun;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:applicationContext-redis.xml")
public class SpringdataRedisDemo {

    @Autowired
    RedisTemplate redisTemplate;

    @Test
    public void test(){
        redisTemplate.boundValueOps("name").set("张三");
        String name =(String) redisTemplate.boundValueOps("name").get();

        System.out.println(name);
    }

    @Test
    public void test2(){
        redisTemplate.opsForValue().set("name","李四");
    }

    @Test
    public void test3(){
        redisTemplate.boundValueOps("school").set("积云");
    }



}
